package com.d3works.apps.businessproject.db.repo;

import com.d3works.apps.businessproject.service.app.AppBusinessProjectService;
import com.d3works.apps.sale.db.SaleOrder;
import com.d3works.apps.supplychain.db.repo.SaleOrderSupplychainRepository;
import com.d3works.inject.Beans;

public class SaleOrderProjectRepository extends SaleOrderSupplychainRepository {
  @Override
  public SaleOrder copy(SaleOrder entity, boolean deep) {

    SaleOrder copy = super.copy(entity, deep);

    if (Beans.get(AppBusinessProjectService.class).isApp("business-project")) {
      copy.setProject(null);
    }

    return copy;
  }
}
